home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / BBS / MUBBS / MUBBS etc.cpt / Module Source / Time Module / Time Module Main.c < prev    next >
Text File  |  1991-11-22  |  2KB  |  78 lines

  1. /*
  2.  *  Time Module Main.c
  3.  *
  4.  *    This program source code and it's compiled version is
  5.  *  Copyright (c) 1991 N. Hawthorn.
  6.  *  This program source code and it's compiled version IS NOT IN THE
  7.  *  PUBLIC DOMAIN ! Please read the "COPYRIGHT NOTICE / NH" file for details
  8.  *  regarding use of this program source code and it's compiled version.
  9.  *
  10.  *  This module's name is "time", it's type is "MOD1", it's ID is 144
  11.  *  Use a resource mover to assign a new number to it !
  12.  *
  13.  *  This is where it all starts...
  14.  *
  15.  */
  16.  
  17. #define INMAIN
  18.  
  19. #include <SetUpA4.h>
  20. #include "MUBBS Module.h"
  21.  
  22. pascal void main (mode1,G1,P1) /* called from the main routines, and what mode to be in */
  23. int mode1;
  24. struct GS *G1; /* we point to the "global" struct in the Main Module here */
  25. Ptr P1; /* we ignore this pointer, we do not use it at all */
  26. {
  27. Handle temph;
  28. float version = 0.5; /* what version of MUBBS you are compatable with IE: .5 and above */
  29. RememberA0(); SetUpA4(); /* This sets up the A4 register to access our globals */
  30. asm { _RecoverHandle }; asm {move.l a0,temph}; HLock(temph); /* locks our module, do this ! */
  31.  
  32. G=G1; /* This MUST be the first thing you do in main only, it sets up the struct globals */
  33. mode[u]=mode1; /* set up our mode so that you can read it anywhere */
  34.  
  35. switch (mode[u]) { /* any un-handled modes return error from this module */
  36.     case 2:
  37.         doit();
  38.         G->moduleresult=0;
  39.         break;
  40.     case 98:
  41.         versionck(version); /* just return after this call, don't modify anything */
  42.         break;        
  43.     case 0:
  44.         strcpy (G->programmer,"N Hawthorn"); /* show the programmer's name up to 20 chars*/
  45.         G->moduleresult=0; /* this was also a init call if we need close call put 99 here */
  46.         break;
  47.     default:
  48.         G->moduleresult=1; /* return bad code */
  49.     };
  50.  
  51. HUnlock(temph); /* unlocks this module, do this ! */
  52. RestoreA4(); /* call this when you are all done */
  53. }
  54.  
  55. doit()
  56. {
  57.  
  58. char datetime[25];
  59.  
  60. if (!G->online[u]) goto byebye; /* do this check so we can log out if hang up */
  61.  
  62. loguser(G->modulename[u]); /* this tells where you are for remote sysop, or writes to log file */
  63.  
  64. /* you print the following so that the sysop can monitor use on the mac screen */
  65.  
  66. print("C> Line %d %s, at: %s\n",(u+1),G->username[u],G->modulename[u]);
  67.  
  68.     getdatetime(datetime); /* gets the date & time */
  69.     send("]You are on line %d, %s]", (u+1), datetime);
  70.     send("]Time on %d minute(s) so far, %d allowed.]]",G->timeon[u],G->timeallowed[u]);
  71.  
  72. return;
  73.  
  74. byebye:
  75. G->online[u]=FALSE; /* show we timed out */
  76. }
  77.  
  78.